﻿Imports DataAccess
Imports DTO

Public Class BSGroup
    Dim serverName1 As String

    Public Sub New(ByVal serverName As String)
        'Lay gia tri serverName ben Form
        serverName1 = serverName
        DAGroup.ConfigServerName(serverName)
    End Sub

    '/******************************************************************/
    '/*             Lay datatable tu DataAccess                        */
    '/******************************************************************/
    Public Function GetAllGroup() As DataTable
        Return DAGroup.GetAllGroup()
    End Function

    Public Function EditGetAllGroup() As DataTable
        Dim dt As DataTable = DAGroup.GetAllGroup()
        'Add them dong du lieu cuoi la "<<Choose another Group>>"
        dt.Rows.Add("1290", "<<Choose another group>>")
        Return dt
    End Function

    '/******************************************************************/
    '/*             Insert group                                       */
    '/******************************************************************/
    Public Function InsertGroup(ByVal groupID As Integer, ByVal groupName As String) As Integer
        Dim dtoGroup As New DTOGroup
        dtoGroup.GroupIdProperty = groupID
        dtoGroup.GroupNameProperty = groupName
        Return DAGroup.InsertGroup(dtoGroup)
    End Function

    '/******************************************************************/
    '/*             Delete group                                       */
    '/******************************************************************/
    Public Function DeleteGroup(ByVal groupID As Integer) As Integer
        Return daGroup.DeleteGroup(groupID)
    End Function

End Class
